package com.sxfq.loansupermarket.backsystem.modular.basicData.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.modular.base.SqlMapper;
import com.sxfq.loansupermarket.backsystem.modular.basicData.dao.TaskScoreDao;
import com.sxfq.loansupermarket.backsystem.modular.basicData.entity.PointRewordInfo;
import com.sxfq.loansupermarket.backsystem.modular.basicData.entity.SearchPointRewordInfo;
import com.sxfq.loansupermarket.backsystem.modular.basicData.service.TaskScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class TaskScoreServiceImpl implements TaskScoreService {
    @Autowired
    private TaskScoreDao dao;

    @Autowired
    private SqlMapper sqlMapper;

    @Override
    public List<PointRewordInfo> selectPageListByQueryGetMap(Page<PointRewordInfo> page, SearchPointRewordInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getTypeName())) {
            params.put("typeName", searchInfo.getTypeName());
        }
        params.put("startIndex", searchInfo.getStartIndex());
        params.put("limitIndex", searchInfo.getLimitIndex());
        return dao.getQueryPage(page, params);
    }

    @Override
    public int getQueryPagesPointCount(Page<PointRewordInfo> page, SearchPointRewordInfo info) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(info.getTypeName())) {
            params.put("typeName", info.getTypeName());
        }
        return dao.getQueryPagePointCount(page, params);
    }

}